﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Script.Serialization;
using iRealtor.Maps.Core.Entities;
using iRealtor.Maps.Core.Services;
using iRealtor.Maps.DataAccess.Models;

namespace iRealtor.Maps.Test
{
	class Program
	{
		static void Main(string[] args)
		{
			var _placeService = new PlacesService();

			#region
			//var _groupService = new GroupsService();

			//var places = _placeService.GetPlaces();
			//var groups = _groupService.GetGroups();

			//List<GroupView> groupViews = new List<GroupView>();
			//var ll = places.GroupBy(p => p.Place.GroupId).ToList();

			//foreach (var p in ll)
			//{
			//    if (p.Key == null)
			//    {
			//        foreach (var place in p.ToList())
			//        {
			//            var gv = new GroupView()
			//                        {
			//                            Group = null,
			//                            PlaceViews = new List<PlaceView>()
			//                        };

			//            gv.PlaceViews.Add(place);
			//            groupViews.Add(gv);
			//        }
			//    }
			//    else
			//    {
			//        var gv = new GroupView
			//                    {
			//                        Group = groups.FirstOrDefault(g => g.GroupId == p.Key),
			//                        PlaceViews = p.ToList()
			//                    };

			//        groupViews.Add(gv);
			//    }
			//}
#endregion

			var place111 = new Place
				{
					Name = "Snow q",
					Description = "Снежная Королева",
					Latitude = 46.2972694,
					Longitude = 30.6411694
				};

			_placeService.AddNewPlace(place111);

		}
	}
}
